#ifndef __WIZ_VFS_BLOCKSTORAGE_HPP__SHANHAOBO_19800429__
#define __WIZ_VFS_BLOCKSTORAGE_HPP__SHANHAOBO_19800429__

#include "../WizInnerVFS.hpp"
#include "./WizVFSBlockStorageChunk.hpp"
#include "./WizVFSBlockStorageDirTree.hpp"
#include "./WizVFSBlockStorageParam.hpp"

namespace Wiz
{
    namespace VFS
    {
        namespace BlockStorage
        {
            struct Type : public ::Wiz::Inner::VFS::Type
            {
                Type();
                Type(::Wiz::VFS::Info::BlockStorage::In);

                //////////////////////////////////////////////////////////////////////////

                ::Wiz::Bool::Type           ExpandByAppendChunk();
                ::Wiz::Bool::Type           Read(::Wiz::Byte::OutPtr, ::Wiz::Size::In, ::Wiz::VFS::BlockStorage::Param::InOut);
                ::Wiz::Bool::Type           Write(::Wiz::Byte::InPtr, ::Wiz::Size::In, ::Wiz::VFS::BlockStorage::Param::InOut);
                ::Wiz::Bool::Type           Remove(::Wiz::VFS::BlockStorage::Param::InOut);
                ::Wiz::Void::Type           ReadInfoAndAdvance();
                ::Wiz::Void::Type           WriteInfoAndAdvance();

                ::Wiz::Bool::Type           ReadDirTree();
                ::Wiz::Bool::Type           WriteDirTree();
                ::Wiz::Bool::Type           RemoveDirTree();

                ::Wiz::Bool::Type           Create(::Wiz::String::In);
                ::Wiz::Bool::Type           Load(::Wiz::String::In);

                //////////////////////////////////////////////////////////////////////////

                virtual ::Wiz::Bool::Type   Open(::Wiz::String::In);
                virtual ::Wiz::Void::Type   Close();
                virtual ::Wiz::Bool::Type   Read(::Wiz::ByteBuffer::Out, ::Wiz::String::In);
                virtual ::Wiz::Bool::Type   Write(::Wiz::ByteBuffer::In, ::Wiz::String::In);
                virtual ::Wiz::Bool::Type   Replace(::Wiz::ByteBuffer::In, ::Wiz::String::In);
                virtual ::Wiz::Bool::Type   Remove(::Wiz::String::In);

                virtual ::Wiz::Void::Type   PrintDirTree()
                {
                    m_DirTree.PrintTree();
                }
                //////////////////////////////////////////////////////////////////////////

                ::Wiz::Accessor::Ptr        m_AccessorPtr;
                ::Wiz::File::Ptr            m_FilePtr;

                ::Wiz::VFS::BlockStorage::DirTree::Type
                                            m_DirTree;

                ::Wiz::VFS::BlockStorage::StorageInfo::Type
                                            m_Info;

                ::Wiz::Endian::Type         m_Endian;

                ::Wiz::Size::Type           m_BlockSizeComplete;
                ::Wiz::Size::Type           m_ChunkSize;
                ::Wiz::Size::Type           m_ChunkSizeComplete;
            };
        } /// end of namespace BlockStorage
    } /// end of namespace VFS
} /// end of namespace Wiz

#endif /*__WIZ_VFS_BLOCKSTORAGE_HPP__SHANHAOBO_19800429__*/
